fix(tui): use cross-platform path module for plugin name extraction in /status dialog#34183
Closed
spaciousejar wants to merge 1 commit into
Closed
fix(tui): use cross-platform path module for plugin name extraction in /status dialog#34183spaciousejar wants to merge 1 commit into
spaciousejar wants to merge 1 commit into
Conversation
…n /status dialog
Replace manual path string manipulation (split('/') and split('.')[0])
with path.basename() and path.dirname() from node:path, which
handle both Unix forward-slash and Windows backslash paths correctly.
Fixes anomalyco#34141
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate FoundPR #33375: This PR appears to address the same issue — fixing cross-platform path handling for plugin name extraction in the status dialog. Both PRs target the same file ( |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Author
|
Duplicate of #33375 — same bug, same file, different approach. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #34141
Type of change
What does this PR do?
On Windows, the
/statusdialog displays a truncated path prefix (e.g.C:\\Users\\abc) instead of the actual plugin name for file-based plugins in~/.config/opencode/plugins/.Root cause in
packages/tui/src/component/dialog-status.tsx:split("/")does not split Windows backslash paths — returns the entire path as a single element.split(".")[0]on the full path captures the first dot in the path (.config) rather than the file extensionFix: replace manual string splitting with
path.basename()andpath.dirname()fromnode:path, which handle both Unix (/) and Windows (\\\\) path separators correctly. The local variable was renamed frompathtofilePathto avoid shadowing the path module import.How did you verify your code works?
bunx tsc --noEmit— no new type errors introduced (all 33 errors are pre-existing, none indialog-status.tsx)C:\\Users\\abc\\.config\\opencode\\plugins\\my-plugin\\index.ts→path.basenamereturnsindex.ts→index→ falls through to parent dirmy-plugin✓/home/user/.config/opencode/plugins/my-plugin.ts→path.basenamereturnsmy-plugin.ts→my-plugin✓/path/to/my-plugin→path.basenamereturnsmy-plugin→ no dot → returns as-is ✓Screenshots / recordings
N/A — TUI change, no screenshot possible.
Checklist